package com.example.msgBoard.mapper;

import com.example.msgBoard.model.User;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {
    @Insert("INSERT INTO users(username, password, role) VALUES(#{username}, #{password}, #{role})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insertUser(User user);

    @Select("SELECT * FROM users WHERE username = #{username}")
    User findByUsername(String username);

//    @Select("SELECT * FROM users WHERE username = #{username} AND password = #{password}")
//    User login(String username, String password);

    // 其他必要的CRUD操作
}
